﻿using System;
using System.Collections.Generic;

using System.Text;
using RebEngine.Managers;
using TomShane.Neoforce.Controls;
using Microsoft.Xna.Framework.Graphics;

namespace RebellionII.GUI
{
    public class TeamSelection
    {
        #region Window
        public Window MainWindow { get; set; }
        #endregion Window

        public Button ButtonOne;
        public Button ButtonTwo;

        public Label lblPlayerTwo { get; set; }
        public Label lblplayerOne { get; set; }
        public CheckBox chkDblStartingPlanets { get; set; }
        public ComboBox cmbRimMax { get; set; }
        public ComboBox cmbRimMin { get; set; }
        public ComboBox cmbMidMax { get; set; }
        public ComboBox cmbMidMin { get; set; }
        public ComboBox cmbCoreMax { get; set; }
        public ComboBox cmbCoreMin { get; set; }
        public ComboBox cmbJediBonus { get; set; }
        public ComboBox cmbTroopBonus { get; set; }
        public ComboBox cmbShipBonus { get; set; }
        public ComboBox cmbFacilityBonus { get; set; }
        public ComboBox cmbTeamFavoured { get; set; }
        private Label label2;
        private Label label3;
        private Label label4;
        private Label label10;
        private Label label11;
        private Label label12;
        private Label label5;
        private Label label6;
        private Label label7;
        private Label label8;
        private Label label1;
        private Panel panel2;
        private ImageBox pictureBox2;
        private Label label14;
        private Panel panel1;
        private ImageBox pictureBox1;
        private Label label13;



        public TeamSelection(bool readOnly)
        {
            readOnly = !readOnly;

            MainWindow = new Window(InputManager.Manager);
            MainWindow.Init();
            MainWindow.Name = "teamSelectionWindow";
            MainWindow.Text = "New Window";
            MainWindow.Width = 780;
            MainWindow.Height = 675;
            MainWindow.Center();

            
            ButtonOne = new Button(InputManager.Manager);
            ButtonOne.Init();
            ButtonOne.Left = 465;
            ButtonOne.Top = 541;
            ButtonOne.Width = 113;
            ButtonOne.Height = 39;
            ButtonOne.Text = "Close";
            ButtonOne.Parent = MainWindow;


            ButtonTwo = new Button(InputManager.Manager);
            ButtonTwo.Init();
            ButtonTwo.Left = 213;
            ButtonTwo.Top = 541;
            ButtonTwo.Width = 113;
            ButtonTwo.Height = 39;
            ButtonTwo.Text = "Begin";
            ButtonTwo.Parent = MainWindow;

            lblPlayerTwo = new Label(InputManager.Manager);
            lblPlayerTwo.Init();
            lblPlayerTwo.Left = 561;
            lblPlayerTwo.Top = 351;
            lblPlayerTwo.Width = 80;
            lblPlayerTwo.Height = 13;
            lblPlayerTwo.Text = "No Player";
            lblPlayerTwo.Parent = MainWindow;

            lblplayerOne = new Label(InputManager.Manager);
            lblplayerOne.Init();
            lblplayerOne.Left = 168;
            lblplayerOne.Top = 351;
            lblplayerOne.Width = 80;
            lblplayerOne.Height = 13;
            lblplayerOne.Text = "No Player";
            lblplayerOne.Parent = MainWindow;

            chkDblStartingPlanets = new CheckBox(InputManager.Manager);
            chkDblStartingPlanets.Init();
            chkDblStartingPlanets.Left = 540;
            chkDblStartingPlanets.Top = 487;
            chkDblStartingPlanets.Width = 200;
            chkDblStartingPlanets.Height = 17;
            chkDblStartingPlanets.Text = "Double Starting Planets";
            chkDblStartingPlanets.Parent = MainWindow;
            chkDblStartingPlanets.Checked = EngineManager.Settings.DoubleStartingPlanets;

            cmbRimMax = new ComboBox(InputManager.Manager);
            cmbRimMax.Init();
            cmbRimMax.Left = 611;
            cmbRimMax.Top = 456;
            cmbRimMax.Width = 121;
            cmbRimMax.Height = 21;
            cmbRimMax.Text = EngineManager.Settings.RimMaxFacilities.ToString();
            cmbRimMax.Items.Add("10");
            cmbRimMax.Items.Add("12");
            cmbRimMax.Items.Add("14");
            cmbRimMax.Items.Add("16");
            cmbRimMax.Parent = MainWindow;

            cmbRimMin = new ComboBox(InputManager.Manager);
            cmbRimMin.Init();
            cmbRimMin.Left = 611;
            cmbRimMin.Top = 429;
            cmbRimMin.Width = 121;
            cmbRimMin.Height = 21;
            cmbRimMin.Text = EngineManager.Settings.RimMinFacilities.ToString();
            cmbRimMin.Items.Add("2");
            cmbRimMin.Items.Add("4");
            cmbRimMin.Items.Add("6");
            cmbRimMin.Parent = MainWindow;

            cmbMidMax = new ComboBox(InputManager.Manager);
            cmbMidMax.Init();
            cmbMidMax.Left = 611;
            cmbMidMax.Top = 399;
            cmbMidMax.Width = 121;
            cmbMidMax.Height = 21;
            cmbMidMax.Text = EngineManager.Settings.MidMaxFacilities.ToString();
            cmbMidMax.Items.Add("8");
            cmbMidMax.Items.Add("10");
            cmbMidMax.Items.Add("12");
            cmbMidMax.Items.Add("14");
            cmbMidMax.Parent = MainWindow;

            cmbMidMin = new ComboBox(InputManager.Manager);
            cmbMidMin.Init();
            cmbMidMin.Left = 365;
            cmbMidMin.Top = 485;
            cmbMidMin.Width = 121;
            cmbMidMin.Height = 21;
            cmbMidMin.Text = EngineManager.Settings.MidMinFacilities.ToString();
            cmbMidMin.Items.Add("4");
            cmbMidMin.Items.Add("6");
            cmbMidMin.Items.Add("8");
            cmbMidMin.Parent = MainWindow;

            cmbCoreMax = new ComboBox(InputManager.Manager);
            cmbCoreMax.Init();
            cmbCoreMax.Left = 365;
            cmbCoreMax.Top = 458;
            cmbCoreMax.Width = 121;
            cmbCoreMax.Height = 21;
            cmbCoreMax.Text = EngineManager.Settings.CoreMaxFacilities.ToString();
            cmbCoreMax.Items.Add("10");
            cmbCoreMax.Items.Add("12");
            cmbCoreMax.Items.Add("14");
            cmbCoreMax.Items.Add("16");
            cmbCoreMax.Parent = MainWindow;

            cmbCoreMin = new ComboBox(InputManager.Manager);
            cmbCoreMin.Init();
            cmbCoreMin.Left = 365;
            cmbCoreMin.Top = 431;
            cmbCoreMin.Width = 121;
            cmbCoreMin.Height = 21;
            cmbCoreMin.Text = EngineManager.Settings.CoreMinFacilities.ToString();
            cmbCoreMin.Items.Add("4");
            cmbCoreMin.Items.Add("6");
            cmbCoreMin.Items.Add("8");
            cmbCoreMin.Items.Add("10");
            cmbCoreMin.Parent = MainWindow;

            cmbJediBonus = new ComboBox(InputManager.Manager);
            cmbJediBonus.Init();
            cmbJediBonus.Left = 365;
            cmbJediBonus.Top = 401;
            cmbJediBonus.Width = 121;
            cmbJediBonus.Height = 21;
            cmbJediBonus.Text = EngineManager.Settings.ChanceJediBonus.ToString();
            cmbJediBonus.Items.Add("2");
            cmbJediBonus.Items.Add("4");
            cmbJediBonus.Items.Add("6");
            cmbJediBonus.Items.Add("10");
            cmbJediBonus.Items.Add("15");
            cmbJediBonus.Parent = MainWindow;

            cmbTroopBonus = new ComboBox(InputManager.Manager);
            cmbTroopBonus.Init();
            cmbTroopBonus.Left = 119;
            cmbTroopBonus.Top = 485;
            cmbTroopBonus.Width = 121;
            cmbTroopBonus.Height = 21;
            cmbTroopBonus.Text = EngineManager.Settings.ChanceTroopBonus.ToString();
            cmbTroopBonus.Items.Add("2");
            cmbTroopBonus.Items.Add("4");
            cmbTroopBonus.Items.Add("6");
            cmbTroopBonus.Items.Add("10");
            cmbTroopBonus.Items.Add("15");
            cmbTroopBonus.Parent = MainWindow;

            cmbShipBonus = new ComboBox(InputManager.Manager);
            cmbShipBonus.Init();
            cmbShipBonus.Left = 119;
            cmbShipBonus.Top = 458;
            cmbShipBonus.Width = 121;
            cmbShipBonus.Height = 21;
            cmbShipBonus.Text = EngineManager.Settings.ChanceShipBonus.ToString();
            cmbShipBonus.Items.Add("2");
            cmbShipBonus.Items.Add("4");
            cmbShipBonus.Items.Add("6");
            cmbShipBonus.Items.Add("10");
            cmbShipBonus.Items.Add("15");
            cmbShipBonus.Parent = MainWindow;

            cmbFacilityBonus = new ComboBox(InputManager.Manager);
            cmbFacilityBonus.Init();
            cmbFacilityBonus.Left = 119;
            cmbFacilityBonus.Top = 431;
            cmbFacilityBonus.Width = 121;
            cmbFacilityBonus.Height = 21;
            cmbFacilityBonus.Text = EngineManager.Settings.ChanceFacilityBonus.ToString();
            cmbFacilityBonus.Items.Add("2");
            cmbFacilityBonus.Items.Add("4");
            cmbFacilityBonus.Items.Add("6");
            cmbFacilityBonus.Items.Add("10");
            cmbFacilityBonus.Items.Add("15");
            cmbFacilityBonus.Parent = MainWindow;

            cmbTeamFavoured = new ComboBox(InputManager.Manager);
            cmbTeamFavoured.Init();
            cmbTeamFavoured.Left = 119;
            cmbTeamFavoured.Top = 401;
            cmbTeamFavoured.Width = 121;
            cmbTeamFavoured.Height = 21;
            cmbTeamFavoured.Text = EngineManager.Settings.TeamFavoured.ToString();
            cmbTeamFavoured.Items.Add("Empire");
            cmbTeamFavoured.Items.Add("Alliance");
            cmbTeamFavoured.Items.Add("Even");
            cmbTeamFavoured.Parent = MainWindow;

            label2 = new Label(InputManager.Manager);
            label2.Init();
            label2.Left = 32;
            label2.Top = 483;
            label2.Width = 110;
            label2.Height = 13;
            label2.Text = "Troop Bonus:";
            label2.Parent = MainWindow;

            label3 = new Label(InputManager.Manager);
            label3.Init();
            label3.Left = 39;
            label3.Top = 457;
            label3.Width = 110;
            label3.Height = 13;
            label3.Text = "Ship Bonus:";
            label3.Parent = MainWindow;

            label4 = new Label(InputManager.Manager);
            label4.Init();
            label4.Left = 28;
            label4.Top = 431;
            label4.Width = 110;
            label4.Height = 13;
            label4.Text = "Facility Bonus:";
            label4.Parent = MainWindow;

            label10 = new Label(InputManager.Manager);
            label10.Init();
            label10.Left = 501;
            label10.Top = 456;
            label10.Width = 110;
            label10.Height = 13;
            label10.Text = "Rim Max Facilities:";
            label10.Parent = MainWindow;

            label11 = new Label(InputManager.Manager);
            label11.Init();
            label11.Left = 501;
            label11.Top = 430;
            label11.Width = 110;
            label11.Height = 13;
            label11.Text = "Rim Min Facilities:";
            label11.Parent = MainWindow;

            label12 = new Label(InputManager.Manager);
            label12.Init();
            label12.Left = 501;
            label12.Top = 405;
            label12.Width = 110;
            label12.Height = 13;
            label12.Text = "Mid Max Facilities:";
            label12.Parent = MainWindow;

            label5 = new Label(InputManager.Manager);
            label5.Init();
            label5.Left = 248;
            label5.Top = 488;
            label5.Width = 110;
            label5.Height = 13;
            label5.Text = "Mid Min Facilities:";
            label5.Parent = MainWindow;

            label6 = new Label(InputManager.Manager);
            label6.Init();
            label6.Left = 243;
            label6.Top = 461;
            label6.Width = 120;
            label6.Height = 13;
            label6.Text = "Core Max Facilities:";
            label6.Parent = MainWindow;

            label7 = new Label(InputManager.Manager);
            label7.Init();
            label7.Left = 243;
            label7.Top = 434;
            label7.Width = 120;
            label7.Height = 13;
            label7.Text = "Core Min Facilities:";
            label7.Parent = MainWindow;

            label8 = new Label(InputManager.Manager);
            label8.Init();
            label8.Left = 276;
            label8.Top = 407;
            label8.Width = 110;
            label8.Height = 13;
            label8.Text = "Jedi Bonus:";
            label8.Parent = MainWindow;

            label1 = new Label(InputManager.Manager);
            label1.Init();
            label1.Left = 18;
            label1.Top = 405;
            label1.Width = 110;
            label1.Height = 13;
            label1.Text = "Team Favoured:";
            label1.Parent = MainWindow;

            panel2 = new Panel(InputManager.Manager);
            panel2.Init();
            panel2.Left = 426;
            panel2.Top = 14;
            panel2.Width = 325;
            panel2.Height = 325;
            panel2.Text = "";
            panel2.Parent = MainWindow;

            pictureBox2 = new ImageBox(InputManager.Manager);
            pictureBox2.Init();
            pictureBox2.Left = 65;
            pictureBox2.Top = 74;
            pictureBox2.Width = 199;
            pictureBox2.Height = 203;
            pictureBox2.Image = TextureManager.GetTexture("AllianceSymbol").BaseTexture as Texture2D;
            pictureBox2.Text = "";
            pictureBox2.SizeMode = SizeMode.Stretched;
            panel2.Add(pictureBox2);

            label14 = new Label(InputManager.Manager);
            label14.Init();
            label14.Left = 140;
            label14.Top = 17;
            label14.Width = 120;
            label14.Height = 29;
            label14.Text = "Alliance";
            panel2.Add(label14);

            panel1 = new Panel(InputManager.Manager);
            panel1.Init();
            panel1.Left = 42;
            panel1.Top = 14;
            panel1.Width = 325;
            panel1.Height = 325;
            panel1.Text = "";
            panel1.Parent = MainWindow;

            pictureBox1 = new ImageBox(InputManager.Manager);
            pictureBox1.Init();
            pictureBox1.Left = 56;
            pictureBox1.Top = 74;
            pictureBox1.Width = 199;
            pictureBox1.Height = 203;
            pictureBox1.Text = "";
            pictureBox1.Image = TextureManager.GetTexture("EmpireSymbol").BaseTexture as Texture2D;
            pictureBox1.SizeMode = SizeMode.Stretched;
            panel1.Add(pictureBox1);

            label13 = new Label(InputManager.Manager);
            label13.Init();
            label13.Top = 17;
            label13.Left = 140;
            label13.Width = 120;
            label13.Height = 29;
            label13.Text = "Empire";
            panel1.Add(label13);

            foreach (var temp in MainWindow.Controls)
            {
                temp.Enabled = readOnly;
            }

            label13.Enabled = true;
            label14.Enabled = true;

            pictureBox1.Enabled = true;
            pictureBox2.Enabled = true;

            InputManager.Manager.Add(MainWindow);

        }
    }
}
